import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/views/layout/Layout'
import Login from '@/views/login/Login'
import Dashboard from '@/views/dashboard/Dashboard'
import Echart from '@/views/layout/Echart'
import NotFount from '@/views/exceptrion/404'
import Generator from '../views/generator/Generator'
import GeneratorConfig from '../views/generator/GeneratorConfig'
import System from '../views/system/System'
import Database from '../views/system/Database'
import Borrow from '../views/borrow/Borrow'

Vue.use(Router)

const routes = [
  {
    path: '/login',
    component: Login
  },
  {
    path: '/404',
    component: NotFount
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: Dashboard
      },
      {
        path: '/echart',
        component: Echart
      },
      {
        path: '/generator',
        component: Generator
      },
      {
        path: '/generator-config',
        component: GeneratorConfig
      },
      {
        path: '/dashboard',
        component: Dashboard
      },
      {
        path: '/system',
        component: System
      },
      {
        path: '/database',
        component: Database
      },
      {
        path: '/borrow',
        component: Borrow
      }
    ]
  }

]

const router = new Router({
  // 把常量routes放进来
  mode: 'history',
  routes
})

// 导出router
export default router

